#ifndef __MYSQL__
#define __MYSQL__
#include <stdio.h>
#include <mysql/mysql.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include "dir_stack.h"
//连接数据库
int mysqlConnect(MYSQL** sock);
//ls命令
int ls_order(MYSQL* mysql,const char* user, Link_list_t* list, char* result);
//mkdir命令 
 int mkdir_order(MYSQL* mysql, char* folder_name,const char* user, Link_list_t* list);
int get_salt(char *salt);
int register_user(MYSQL *mysql,char *user_name,char *password);
int log_on(MYSQL *mysql, char *user_name, char *plain_password, char *ret);
//pwd命令
int pwd_order(Link_list_t* list, MYSQL *mysql, char* stackPath);
// 处理idPath
int get_full_path(MYSQL *mysql, const char *idPath, char *stackPath);
int get_id_by_filename(MYSQL *mysql, const char *user, int parent_id, const char *filename);
// cd_order 函数实现
int cd_order(MYSQL *mysql, const char *user, const char *target, Link_list_t *catalog);
// 查询 catalog 表中是否存在符合条件的子目录，返回其 id
int get_id_by_filename(MYSQL *mysql, const char *user, int parent_id, const char *filename);
//rmdir命令
int rmdir_order(MYSQL *mysql, const char *user, const char *dirname, Link_list_t *catalog);
int is_dir_empty(MYSQL *mysql, const char *user, int dir_id);
int check_name_exists(MYSQL *mysql, const char *user, int parent_id, const char *filename);

#endif
